import { Injectable } from '@angular/core';
import { RestService, PagedResultDto } from '@abp/ng.core';
import { Observable } from 'rxjs';
import { CreateUpdateRfidDto, RfidDto } from './models';

@Injectable({
  providedIn: 'root'
})
export class RfidService {
  apiName = 'Default';

  constructor(private restService: RestService) {}

  getList(params: any = {}): Observable<PagedResultDto<RfidDto>> {
    return this.restService.request<any, PagedResultDto<RfidDto>>({
      method: 'GET',
      url: '/api/app/rfid',
      params
    });
  }

  create(input: CreateUpdateRfidDto): Observable<RfidDto> {
    return this.restService.request<CreateUpdateRfidDto, RfidDto>({
      method: 'POST',
      url: '/api/app/rfid',
      body: input,
    });
  }

  update(id: string, input: CreateUpdateRfidDto): Observable<RfidDto> {
    return this.restService.request<CreateUpdateRfidDto, RfidDto>({
      method: 'PUT',
      url: `/api/app/rfid/${id}`,
      body: input,
    });
  }

  delete(id: string): Observable<any> {
    return this.restService.request<void, any>({
      method: 'DELETE',
      url: `/api/app/rfid/${id}`,
    });
  }

  get(id: string): Observable<RfidDto> {
    return this.restService.request<void, RfidDto>({
      method: 'GET',
      url: `/api/app/rfid/${id}`,
    });
  }
} 